package cn.iocoder.yudao.module.trade.job.brokerage;

import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 分销团队任务奖励发放 Job
 *
 * @author owen
 */
@Component
@Slf4j
public class BrokerageTeamRewardJob implements JobHandler {
    @Resource
    private BrokerageRecordService brokerageRecordService;

    @Override
    @TenantJob
    public String execute(String param) {
        log.info("[任务启动] 定时任务：分销团队任务奖励发放（游戏任务）开始执行");
        int count = brokerageRecordService.rewardTriggerJob();
        log.info("[任务完成] 分销团队任务奖励发放处理完成：用户成功完成一推二并发放奖励:{} 个", count);
        return StrUtil.format("成功完成一推二并发放奖励 {} 个", count);
    }
}
